package com.benhil.hrms.aop;

import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.log4j.Logger;
import org.springframework.aop.interceptor.CustomizableTraceInterceptor;

public class TraceInterceptor extends CustomizableTraceInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = -9168806350196941689L;
	
	private Logger LOG = Logger.getLogger(TraceInterceptor.class);
	
	@Override
	protected void writeToLog(Log logger, String message, Throwable ex) {
		if (ex != null) {
			LOG.debug(message, ex);
		} else {
			LOG.debug(message);
		}
	}
	
	@Override
	protected boolean isInterceptorEnabled(MethodInvocation invocation,	Log logger) {
		return true;
	}

}
